package com.neo.scalaCookBook.C1_String

/**
  * Autuor : zhaoshun
  * Time   : 2017/10/17 7:39
  * Email  : tmby1314@163.com  
  */

/**
  * what are you to do something, describe it
  */
object StringVarReplece {


  /**
    * 变量替换
    * @param args
    */
  def main(args: Array[String]): Unit = {
    val name = "neo.zhao"
    val age = 29
    val weight = 200.00

    println("'s'作为插值,它其实是一个方法,也可以自己定义插值函数")
    val s1 = s"$name is $age"
    println(s1)
    println(s"$name is $age")
    println("在字符串中使用表达式")
    println(s"$name is ${age + 1} weight is $weight")
    println("也可以格式化,用插值方法'f'")
    val out = f"$name ，weight is $weight%.3f "
    println(out)
    println("raw 插入符号")
    println(s"foo\\nbar")
    println(s"foo\nbar")
    println(raw"foo\nbar")
  }
}
